import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import MintUI from 'mint-ui';
import 'mint-ui/lib/style.css'
import Vfilter from '../src/common/filter'


Vue.use(MintUI)



Vue.config.productionTip = false;

router.beforeEach((to, from, next) => {
    /* 路由发生变化修改页面title */
    // this.token = localStorage.getItem("token");
    if (to.meta.title) {
        document.title = to.meta.title
    }
    // next()
    if (to.meta.isLogin) {
        if (localStorage.getItem('Token')) {
            next()
        } else {
            next({
                path: '/login'
            })
        }
    } else {
        next()
    }
})

for (let key in Vfilter) {
    Vue.filter(key, Vfilter[key])
}


new Vue({
    router,
    render: h => h(App)
}).$mount("#app");